package com.airforcehospital;

import com.alibaba.fastjson2.JSONObject;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;

public class Main {
    public static void main(String[] args) {
        CloseableHttpResponse response ;
        JSONObject result=null;
        CloseableHttpClient httpclient = HttpClients.createDefault();
        HttpGet get = new HttpGet("http://localhost:8080/session");
        RequestConfig requestConfig = RequestConfig.custom()
                .setConnectTimeout(50000) // 连接超时时间，单位毫秒
                .setSocketTimeout(50000)  // 读取超时时间，单位毫秒
                .build();
        get.setConfig(requestConfig);
        try{
            response = httpclient.execute(get);
            String body = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
            //result = JSONObject.parseObject(body);
            System.out.println(body);
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
